//
//  NICommonButton.m
//  AIWAYS
//
//  Created by Marx on 2018/9/3.
//  Copyright © 2018年 wlq. All rights reserved.
//

#import "NICommonButton.h"
#import "ColorDefine.h"
@interface NICommonButton()
{
    BOOL reloadStyle;
}
@end
@implementation NICommonButton

-(void)setStyle
{
    if (self.isFocus) {
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.layer.backgroundColor = NIColorLinkButtonColor.CGColor;
        self.layer.masksToBounds = YES;
        self.layer.cornerRadius = 5.0f;
    }
    else
    {

        [self setTitleColor:NIColorTitleTextColor forState:UIControlStateNormal];
        self.layer.backgroundColor = [UIColor whiteColor].CGColor;
        self.layer.masksToBounds = YES;
        self.layer.borderColor = NIColorTitleTextColor.CGColor;
        self.layer.borderWidth = 1.0f;
        self.layer.cornerRadius = 5.0f;
    }

}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    [super drawRect:rect];
    if (!reloadStyle) {
        [self setStyle];
        reloadStyle = YES;
    }
}
@end
